package com.kangtu.demoaskpager.ask.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kangtu.demoaskpager.ask.entity.TbAsk;
import com.kangtu.demoaskpager.ask.service.ITbAnswerService;
import com.kangtu.demoaskpager.ask.service.ITbAskService;
import com.kangtu.demoaskpager.util.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: demo-weix-pay
 * @description: MainController
 * @author: 亮子说编程
 * @create: 2021-03-23 18:27
 **/

@Slf4j
@RestController
//@RequestMapping("/live")
public class MainController {

    @Autowired
    private ITbAskService tbAskService;

    @Autowired
    private ITbAnswerService tbAnswerService;

    /**
     * @Description: 分页获取题库问题
     * @Param: [pageNo, pageSize]
     * @return: com.kangtu.demoaskpager.util.ResponseResult
     * @Author: 亮子
     * @Date: 2021/3/23 18:58
     */
    @GetMapping(value = "/getAskByPage")
    public ResponseResult getAskByPage(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {

        ResponseResult result = tbAskService.getAskByPage(pageNo, pageSize);

        return result;
    }

    @GetMapping(value = "/getAnswerByAskId")
    public ResponseResult getAnswerByAskId(@RequestParam("askId") Long askId) {
        ResponseResult result = tbAnswerService.getAnswerByAskId(askId);

        return result;
    }


}
